package cn.liit.weixin.core.config;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import name.zbq.bush.exception.PropertyNotFoundException;

public class Config {
	//微信支付商户开通后 微信会提供appid和appsecret和商户号partner
	public final static String appid;
	public final static String appsecret;
	public final static String partner;
	//这个参数partnerkey是在商户后台配置的一个32位的key,微信商户平台-账户设置-安全设置-api安全
	public final static String partnerkey;
	//微信支付成功后通知地址 必须要求80端口并且地址不能带参数
	public final static String notifyurl;
	
	static{
		Properties props = new Properties();
		InputStream inputStream = Config.class.getResourceAsStream("/config/weixin.properties");
		if(inputStream == null) throw new PropertyNotFoundException("weixin.properties not found");
		try {
			props.load(inputStream);
		} catch (IOException e) {
			e.printStackTrace();
		}
		appid = props.getProperty("appid");
		appsecret=props.getProperty("appsecret");
		partner=props.getProperty("partner");
		partnerkey=props.getProperty("partnerkey");
		notifyurl=props.getProperty("notifyurl");
	}

	public static void main(String[] args) {
		System.out.println(Config.appid);
	}
}
